class Solution {
public:
    int maxArea(vector<int>& height) {
        int p_left = 0, p_right = height.size() - 1, res = 0;
        while(p_left != p_right)
        {
            res = max(res, (p_right - p_left) * min(height[p_left], height[p_right]));
            if (height[p_left] > height[p_right]) p_right--;
            else p_left++;
        }
        return res;
    }
};
